﻿using System;
using System.Collections.Generic;
using System.Text;

namespace SanctusSoftware.Music.Lyrics
{
    public class SongLyrics
    {

        #region Constructor

        public SongLyrics()
        {
            songParts = new SongLyricsPartCollection();
            authors = new StringCollection();
            keyWords = new StringCollection();
            catalogs = new StringDictionary();
        }

        #endregion

        #region Public Properties

        private string title = string.Empty;

        public string Title
        {
            get { return title; }
            set { title = value; }
        }

        private string source = string.Empty;

        /// <summary>
        /// The source from which the song was obtained
        /// </summary>
        public string Source
        {
            get { return source; }
            set { source = value; }
        }

        private StringCollection authors;
        
        public StringCollection Authors
        {
            get { return authors; }
        }
	
        public string AuthorList
        {
            get { return authors.GetDelimitedValues();  }
        }

        private StringCollection keyWords;
        
        public StringCollection KeyWords
        {
            get { return keyWords; }
        }

        public string KeyWordList
        {
            get { return keyWords.GetDelimitedValues(); }
        }

        private StringDictionary catalogs;
        
        public StringDictionary Catalogs
        {
            get { return catalogs; }
        }

        public string CatalogList
        {
            get { return catalogs.GetDelimitedList(); }
        }

        private string copyright = string.Empty ;

        public string Copyright
        {
            get { return copyright; }
            set { copyright = value; }
        }

        private string admin = string.Empty;

        public string Admin
        {
            get { return admin; }
            set { admin = value; }
        }

        private SongLyricsPartCollection songParts;
        
        public SongLyricsPartCollection SongParts
        {
            get { return songParts; }
        }

        public string CompleteSongTextWithHeadings
        {
            get
            {
                StringBuilder sb = new StringBuilder();

                foreach (SongLyricsPart sp in this.SongParts)
                {
                    if (sb.Length > 0)
                    {
                        sb.AppendLine();
                    }
                    sb.AppendLine(sp.Title);
                    sb.Append(sp.Words);
                }

                return sb.ToString();
            }
        }
	
        #endregion

        public override string ToString()
        {
            return Title + " (" + AuthorList + ")";
        }


    }
}
